//第四期接口

import { dataAxios } from '../rudexRou/request.js';

//题目管理==============
//列表查询
export const querySubjectData = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/question/queryPage`,
    method: 'post',
    data: data,
  });
};
//查询题目详情
export const querySubjectById = (id) => {
  return dataAxios({
    url: `/tmfsExamPlatform/question/queryById?id=${id}`,
    method: 'get',
  });
};
//修改题目
export const editSubject = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/question/edit`,
    method: 'post',
    data: data,
  });
};
//新增imu
export const addSubject = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/question/addQuestion`,
    method: 'post',
    data: data,
  });
};
//删除题目
export const deleteSubject = (ids) => {
  return dataAxios({
    url: `/tmfsExamPlatform/question/del?ids=${ids}`,
    method: 'delete',
  });
};
//上传文件
export const uploadPackageFile = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/question/uploadFile`,
    method: 'post',
    headers: { 'Content-Type': 'multipart/form-data' },
    data: data,
  });
};
//发布题目
export const publishSubject = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/question/publishStatus?ids=${data.ids}&publishStatus=${data.publishStatus}`,
    method: 'patch',
  });
};

//考试管理
//删除考试
export const deleteExam = (ids) => {
  return dataAxios({
    url: `/tmfsExamPlatform/examActivity?ids=${ids}`,
    method: 'delete',
  });
};
//查询考试列表
export const getExam = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/examActivity`,
    method: 'get',
    params: data,
  });
};
//通过语言查询可用题目
export const getSubject = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/examActivity/candidateQuestion`,
    method: 'get',
    params: data,
  });
};
//新增考试
export const addExam = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/examActivity`,
    method: 'post',
    data: data,
  });
};
//修改考试
export const editExam = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/examActivity`,
    method: 'put',
    data: data,
  });
};
//发布考试
export const publishExam = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/examActivity/publishStatus?ids=${data.ids}&publishStatus=${data.publishStatus}`,
    method: 'patch',
  });
};
//查询可选参考人
export const getCandidate = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/examActivityManager/candidate`,
    method: 'get',
    params: data,
  });
};
//查询已选参考人
export const getEmpInExam = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/examActivityManager/empInExam`,
    method: 'get',
    params: data,
  });
};
//添加参考人
export const addEmpToExam = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/examActivityManager`,
    method: 'post',
    data: data,
  });
};
//移除参考人
export const delEmpInExam = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/examActivityManager?examId=${data.examId}`,
    method: 'delete',
    data:data.empNoList
  });
};
//查询所有人byEmpNoOrEmpName
export const getEmpNoOrEmpName = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/emp/getEmpNoOrEmpName`,
    method: 'get',
    params: data,
  });
};
//查询阅卷人by examId
export const getExaminers = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/examActivityManager/examiners`,
    method: 'get',
    params: data,
  });
};
//查询绑定和未绑定员工
export const getBindExaminerDetail = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/examActivityManager/getBindExaminerDetail`,
    method: 'get',
    params: data,
  });
};
//绑定阅卷人
export const bindExaminers = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/examActivityManager/patchExaminer?examId=${data.examId}&examinerEmpNo=${data.examinerEmpNo}`,
    method: 'patch',
    data: data.empList,
  });
};
//重新绑定阅卷人
export const bindExaminersAgain = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/examActivityManager/rePatchExaminer?examinerEmpNo=${data.examinerEmpNo}`,
    method: 'patch',
    data: data.empList,
  });
};

//我的考试==========================
//查询已完成
export const queryCompletedExam = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/myExam/completedExam`,
    method: 'get',
    params: data,
  });
};
//查询未完成
export const queryShouldExam = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/myExam/shouldExam`,
    method: 'get',
    params: data,
  });
};
//查询可报名的公开考试
export const queryOpenExam = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/myExam/openExam`,
    method: 'get',
    params: data,
  });
};
//查询试卷
export const queryExamPaper = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/myExam/examPaper`,
    method: 'get',
    params: data,
  });
};
//查询进行中考试
export const queryRuningExam = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/myExam/running`,
    method: 'get',
    params: data,
  });
};
//申请参加考试
export const applyExamination = (examId) => {
  return dataAxios({
    url: `/tmfsExamPlatform/myExam/applyExamination?examId=${examId}`,
    method: 'post',
  });
};
//开始考试
export const startExam = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/myExam/startExam`,
    method: 'get',
    params: data,
  });
};
//重考
export const restartExam = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/myExam/restartExam`,
    method: 'get',
    params: data,
  });
};
//交卷
export const endExam = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/myExam/endExam`,
    method: 'get',
    params: data,
  });
};
//检查答案
export const checkAnswer = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/myExam/checkAnswer`,
    method: 'post',
    data: data,
  });
};
//获取服务器当前时间
export const getDateTime = () => {
  return dataAxios({
    url: `/tmfsExamPlatform/myExam/getDateTime`,
    method: 'get',
  });
};
//发布成绩
export const examEmpList = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/grade/examEmpList`,
    method: 'get',
    params: data,
  });
};
//查询可发布考试
export const getExamList = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/grade/myExamActivityQueryPage`,
    method: 'get',
    params: data,
  });
};
